import request from '@/utils/request'

export function login(data) {
    return request({
        url: '/users/login',
        method: 'post',
        data
    })
}

export function register(data) {
    return request({
        url: '/users/register',
        method: 'post',
        data
    })
}

export function getInfo() {
    return request({
        url: '/users/info',
        method: 'get'
    })
}

export function logout() {
    return request({
        url: '/users/logout',
        method: 'get'
    })
}

export function getUsers(data) {
    return request({
        url: '/users',
        method: 'get',
        params: data
    })
}

export function addUser(data) {
    return request({
        url: '/users',
        method: 'post',
        data
    })
}

export function updateUser(id, data) {
    return request({
        url: `/users/${id}`,
        method: 'put',
        data
    })
}

export function deleteUser(id) {
    return request({
        url: `/users/${id}`,
        method: 'delete'
    })
}
